package com.nanrui.mutualinductor.data;


import com.network.utils.LogUtils;

import java.nio.ByteBuffer;
import java.nio.ByteOrder;
import java.util.Arrays;

public class Packet_57_03
        extends DKPacket {
    private short mFlag;
    private short mGrade;
    private float mMeaWinMiniLoad;
    private float mMeaWinRatedLoad;
    private float mPhaseAngle;
    private float mRatedPrimary;
    private float mRatedSecondary;//额定2次
    private float mSurWinRatedLoad;
    private float mSurWinMiniLoad;
    private float mSurWinRatedLoad2;
    private float mSurWinMiniLoad2;
    private float mSurWinRatedLoad3;
    private float mSurWinMiniLoad3;


    private int sBackup;
    private float sDCR;
    private float[] sDErrors;
    private float[] sFErrors;
    private short sFlag;
    private short sGrade;
    private float sMeaWinMiniLoad;
    private float sMeaWinRatedLoad;
    private float sPhaseAngle;
    private float sPhaseError;
    private float sQuadratureError;
    private float sRatedPrimary;
    private float sRatedSecondary;
    private short sResult;
    private short sResult2;
    private short sResult3;
    private float sSecondaryR;
    private short sStatus;
    private float sSurWinMiniLoad;
    private float sSurWinRatedLoad;

    private float sWorkingVoltage;
    private float sXb;

    private float mRatedCapacitance;//额定电容
    private float pl;//频率

    private float sRatedSecondary2;
    private short sGrade2;
    private float sRatedSecondary3;
    private short sGrade3;

    private float[] sUErrors;
    private float[] sURoundErrors;
    private float[] sPhaseRoundDisps;
    private float[] sPhaseDisps;
    private float[] sUErrors2;
    private float[] sURoundErrors2;
    private float[] sPhaseRoundDisps2;
    private float[] sPhaseDisps2;
    private float[] sUErrors3;
    private float[] sURoundErrors3;
    private float[] sPhaseRoundDisps3;
    private float[] sPhaseDisps3;

    public float getmSurWinMiniLoad3() {
        return mSurWinMiniLoad3;
    }

    public void setsGrade(short sGrade) {
        this.sGrade = sGrade;
    }

    public void setsRatedSecondary(float sRatedSecondary) {
        this.sRatedSecondary = sRatedSecondary;
    }

    public void setsResult(short sResult) {
        this.sResult = sResult;
    }

    public void setsResult2(short sResult2) {
        this.sResult2 = sResult2;
    }

    public void setsResult3(short sResult3) {
        this.sResult3 = sResult3;
    }

    public float getmSurWinRatedLoad3() {
        return mSurWinRatedLoad3;
    }

    public float getsRatedSecondary2() {
        return sRatedSecondary2;
    }

    public void setsRatedSecondary2(float sRatedSecondary2) {
        this.sRatedSecondary2 = sRatedSecondary2;
    }

    public short getsGrade2() {
        return sGrade2;
    }

    public void setsGrade2(short sGrade2) {
        this.sGrade2 = sGrade2;
    }

    public float getmSurWinRatedLoad2() {
        return mSurWinRatedLoad2;
    }

    public float getmSurWinMiniLoad2() {
        return mSurWinMiniLoad2;
    }

    public Packet_57_03() {
        super((short) 3, (short) 87);
    }

    public short getmFlag() {
        return this.mFlag;
    }

    public short getmGrade() {
        return this.mGrade;
    }

    public float getmMeaWinMiniLoad() {
        return this.mMeaWinMiniLoad;
    }

    public float getmMeaWinRatedLoad() {
        return this.mMeaWinRatedLoad;
    }

    public float getmPhaseAngle() {
        return this.mPhaseAngle;
    }

    public float getmRatedPrimary() {
        return this.mRatedPrimary;
    }

    public float getmRatedSecondary() {
        return this.mRatedSecondary;
    }

    public float getmSurWinMiniLoad() {
        return this.mSurWinMiniLoad;
    }

    public float getmSurWinRatedLoad() {
        return this.mSurWinRatedLoad;
    }

    public float getsDCR() {
        return this.sDCR;
    }

    public float[] getsDErrors() {
        return this.sDErrors;
    }

    public float[] getsFErrors() {
        return this.sFErrors;
    }

    public short getsFlag() {
        return this.sFlag;
    }


    public short getsGrade() {
        return this.sGrade;
    }

    public float getsMeaWinMiniLoad() {
        return this.sMeaWinMiniLoad;
    }

    public float getsMeaWinRatedLoad() {
        return this.sMeaWinRatedLoad;
    }

    public float getsPhaseAngle() {
        return this.sPhaseAngle;
    }

    public float[] getsPhaseDisps() {
        return this.sPhaseDisps;
    }

    public float getsPhaseError() {
        return this.sPhaseError;
    }

    public float[] getsPhaseRoundDisps() {
        return this.sPhaseRoundDisps;
    }

    public float getsQuadratureError() {
        return this.sQuadratureError;
    }

    public float getsRatedPrimary() {
        return this.sRatedPrimary;
    }

    public float getsRatedSecondary() {
        return this.sRatedSecondary;
    }

    public short getsResult() {
        return this.sResult;
    }
    public short getsResult2() {
        return this.sResult2;
    }
    public short getsResult3() {
        return this.sResult3;
    }

    public float getsSecondaryR() {
        return this.sSecondaryR;
    }

    public short getsStatus() {
        return this.sStatus;
    }

    public float getsSurWinMiniLoad() {
        return this.sSurWinMiniLoad;
    }

    public float getsSurWinRatedLoad() {
        return this.sSurWinRatedLoad;
    }

    public float[] getsUErrors() {
        return this.sUErrors;
    }

    public float[] getsURoundErrors() {
        return this.sURoundErrors;
    }

    public float getsWorkingVoltage() {
        return this.sWorkingVoltage;
    }

    public float getsXb() {
        return this.sXb;
    }




    public int getsBackup() {
        return sBackup;
    }

    public float[] getsUErrors2() {
        return sUErrors2;
    }

    public float[] getsURoundErrors2() {
        return sURoundErrors2;
    }

    public float[] getsPhaseRoundDisps2() {
        return sPhaseRoundDisps2;
    }

    public float[] getsPhaseDisps2() {
        return sPhaseDisps2;
    }

    public float[] getsUErrors3() {
        return sUErrors3;
    }

    public float[] getsURoundErrors3() {
        return sURoundErrors3;
    }

    public float[] getsPhaseRoundDisps3() {
        return sPhaseRoundDisps3;
    }

    public float[] getsPhaseDisps3() {
        return sPhaseDisps3;
    }

    @Override
    byte[] packContent() {
        byte[] arrayOfByte = new byte[30];
        arrayOfByte[0] = ((byte) (byte) this.mFlag);
        //额定一次
        System.arraycopy(ByteBuffer.allocate(4).order(ByteOrder.LITTLE_ENDIAN).putFloat(this.mRatedPrimary).array(), 0, arrayOfByte, 4, 4);
        //额定电容
        System.arraycopy(ByteBuffer.allocate(4).order(ByteOrder.LITTLE_ENDIAN).putFloat(this.mRatedCapacitance).array(), 0, arrayOfByte, 8, 4);
        //频率
        System.arraycopy(ByteBuffer.allocate(4).order(ByteOrder.LITTLE_ENDIAN).putFloat(this.pl).array(), 0, arrayOfByte, 12, 4);
        //功率因子
        System.arraycopy(ByteBuffer.allocate(4).order(ByteOrder.LITTLE_ENDIAN).putFloat(this.mPhaseAngle).array(), 0, arrayOfByte, 16, 4);
          //额定2次
        System.arraycopy(ByteBuffer.allocate(4).order(ByteOrder.LITTLE_ENDIAN).putFloat(this.mRatedSecondary).array(), 0, arrayOfByte, 20, 4);
        // 计量绕组满载负荷
        System.arraycopy(ByteBuffer.allocate(4).order(ByteOrder.LITTLE_ENDIAN).putFloat(this.sMeaWinRatedLoad).array(), 0, arrayOfByte, 24, 4);
        //（计量绕组轻载负荷）
        System.arraycopy(ByteBuffer.allocate(4).order(ByteOrder.LITTLE_ENDIAN).putFloat(this.sMeaWinMiniLoad).array(), 0, arrayOfByte, 28, 4);
        //精度等级
        arrayOfByte[29] = ((byte) (byte) this.mGrade);
        //额定2次
        System.arraycopy(ByteBuffer.allocate(4).order(ByteOrder.LITTLE_ENDIAN).putFloat(this.sRatedSecondary).array(), 0, arrayOfByte, 33, 4);
        // 测量绕组满载负荷
        System.arraycopy(ByteBuffer.allocate(4).order(ByteOrder.LITTLE_ENDIAN).putFloat(this.mSurWinRatedLoad).array(), 0, arrayOfByte, 37, 4);
        //（测量绕组轻载负荷）
        System.arraycopy(ByteBuffer.allocate(4).order(ByteOrder.LITTLE_ENDIAN).putFloat(this.mSurWinMiniLoad).array(), 0, arrayOfByte, 41, 4);
        //精度等级
        arrayOfByte[42] = ((byte) (byte) this.sGrade);
        //额定2次
        System.arraycopy(ByteBuffer.allocate(4).order(ByteOrder.LITTLE_ENDIAN).putFloat(this.sRatedSecondary2).array(), 0, arrayOfByte, 46, 4);
        // 测量绕组满载负荷
        System.arraycopy(ByteBuffer.allocate(4).order(ByteOrder.LITTLE_ENDIAN).putFloat(this.mSurWinRatedLoad2).array(), 0, arrayOfByte, 50, 4);
        //测量绕组轻载负荷）
        System.arraycopy(ByteBuffer.allocate(4).order(ByteOrder.LITTLE_ENDIAN).putFloat(this.mSurWinMiniLoad2).array(), 0, arrayOfByte, 54, 4);
        //精度等级
        arrayOfByte[55] = ((byte) (byte) this.sGrade2);
        return arrayOfByte;
    }

    public Packet_57_03 setmFlag(short paramShort) {
        this.mFlag = ((short) paramShort);
        return this;
    }

    public Packet_57_03 setmGrade(short paramShort) {
        this.mGrade = ((short) paramShort);
        return this;
    }

    public Packet_57_03 setmMeaWinMiniLoad(float paramFloat) {
        this.mMeaWinMiniLoad = paramFloat;
        return this;
    }

    public Packet_57_03 setmMeaWinRatedLoad(float paramFloat) {
        this.mMeaWinRatedLoad = paramFloat;
        return this;
    }

    public Packet_57_03 setmPhaseAngle(float paramFloat) {
        this.mPhaseAngle = paramFloat;
        return this;
    }

    public Packet_57_03 setmRatedPrimary(float paramFloat) {
        this.mRatedPrimary = paramFloat;
        return this;
    }

    public Packet_57_03 setmRatedSecondary(float paramFloat) {
        this.mRatedSecondary = paramFloat;
        return this;
    }

    public Packet_57_03 setmSurWinMiniLoad(float paramFloat) {
        this.mSurWinMiniLoad = paramFloat;
        return this;
    }

    public Packet_57_03 setmSurWinRatedLoad(float paramFloat) {
        this.mSurWinRatedLoad = paramFloat;
        return this;
    }
    public Packet_57_03 setmSurWinMiniLoad3(float paramFloat) {
        this.mSurWinMiniLoad3 = paramFloat;
        return this;
    }

    public Packet_57_03 setmSurWinRatedLoad2(float paramFloat) {
        this.mSurWinRatedLoad2 = paramFloat;
        return this;
    }
    public Packet_57_03 setmSurWinMiniLoad2(float paramFloat) {
        this.mSurWinMiniLoad2 = paramFloat;
        return this;
    }

    public Packet_57_03 setmSurWinRatedLoad3(float paramFloat) {
        this.mSurWinRatedLoad3 = paramFloat;
        return this;
    }
    //额定电容
    public float getmRatedCapacitance() {
        return mRatedCapacitance;
    }
    //额定电容
    public Packet_57_03 setmRatedCapacitance(float mRatedCapacitance) {
        this.mRatedCapacitance = mRatedCapacitance;
        return this;
    }

    //频率
    public float getPl() {
        return pl;
    }
    //频率
    public void setPl(float pl) {
        this.pl = pl;
    }

    @Override
    void unpackContent(byte[] paramArrayOfByte) {
        this.sFlag = ((short) (short) (paramArrayOfByte[0] & 0xFF));
        this.sResult = ((short) (short) (paramArrayOfByte[1] & 0xFF));
        this.sResult2 = ((short) (short) (paramArrayOfByte[2] & 0xFF));
        this.sResult3 = ((short) (short) (paramArrayOfByte[3] & 0xFF));
        this.sStatus = ((short) (short) (paramArrayOfByte[4] & 0xFF));
        int k = paramArrayOfByte[5];
        this.sBackup = (k & 0xFF | paramArrayOfByte[6] << 8 & 0xFFFF);
        //额定1次
        this.mRatedPrimary = ByteBuffer.wrap(Arrays.copyOfRange(paramArrayOfByte, 7, 11)).order(ByteOrder.LITTLE_ENDIAN).getFloat();
        //额定电容
        this.mRatedCapacitance = ByteBuffer.wrap(Arrays.copyOfRange(paramArrayOfByte, 11, 15)).order(ByteOrder.LITTLE_ENDIAN).getFloat();
        //频率
        this.pl = ByteBuffer.wrap(Arrays.copyOfRange(paramArrayOfByte, 15, 19)).order(ByteOrder.LITTLE_ENDIAN).getFloat();
        //功率因子
        this.mPhaseAngle = ByteBuffer.wrap(Arrays.copyOfRange(paramArrayOfByte, 19, 23)).order(ByteOrder.LITTLE_ENDIAN).getFloat();
        //额定2次
        this.mRatedSecondary = ByteBuffer.wrap(Arrays.copyOfRange(paramArrayOfByte, 23, 27)).order(ByteOrder.LITTLE_ENDIAN).getFloat();
        // 计量绕组满载负荷
        this.sMeaWinRatedLoad = ByteBuffer.wrap(Arrays.copyOfRange(paramArrayOfByte, 27, 31)).order(ByteOrder.LITTLE_ENDIAN).getFloat();
        //（计量绕组轻载负荷）
        this.sMeaWinMiniLoad = ByteBuffer.wrap(Arrays.copyOfRange(paramArrayOfByte, 31, 35)).order(ByteOrder.LITTLE_ENDIAN).getFloat();
        //精度等级
        this.mGrade = ((short) (short) (paramArrayOfByte[36] & 0xFF));
        //额定2次
        this.sRatedSecondary = ByteBuffer.wrap(Arrays.copyOfRange(paramArrayOfByte, 37, 41)).order(ByteOrder.LITTLE_ENDIAN).getFloat();
        // 计量绕组满载负荷
        this.mSurWinRatedLoad = ByteBuffer.wrap(Arrays.copyOfRange(paramArrayOfByte, 41, 45)).order(ByteOrder.LITTLE_ENDIAN).getFloat();
        //（计量绕组轻载负荷）
        this.mSurWinMiniLoad = ByteBuffer.wrap(Arrays.copyOfRange(paramArrayOfByte, 45, 49)).order(ByteOrder.LITTLE_ENDIAN).getFloat();
        //精度等级
        this.sGrade = ((short) (short) (paramArrayOfByte[50] & 0xFF));
        //额定2次
        this.sRatedSecondary2 = ByteBuffer.wrap(Arrays.copyOfRange(paramArrayOfByte, 51, 55)).order(ByteOrder.LITTLE_ENDIAN).getFloat();
       //计量绕组满载负荷
        this.mSurWinRatedLoad2 = ByteBuffer.wrap(Arrays.copyOfRange(paramArrayOfByte, 55, 59)).order(ByteOrder.LITTLE_ENDIAN).getFloat();
        ////（计量绕组轻载负荷）
        this.mSurWinMiniLoad2 = ByteBuffer.wrap(Arrays.copyOfRange(paramArrayOfByte, 59, 63)).order(ByteOrder.LITTLE_ENDIAN).getFloat();
        //精度等级
        this.sGrade2 = ((short) (short) (paramArrayOfByte[64] & 0xFF));

        this.sPhaseError = ByteBuffer.wrap(Arrays.copyOfRange(paramArrayOfByte, 65, 69)).order(ByteOrder.LITTLE_ENDIAN).getFloat();
        this.sQuadratureError = ByteBuffer.wrap(Arrays.copyOfRange(paramArrayOfByte, 69, 73)).order(ByteOrder.LITTLE_ENDIAN).getFloat();

        this.sFErrors = new float[3];
        int i =73;
         k = 0;
        int j = 0;
        float[] arrayOfFloat = null;
        int m;
        while (j < this.sFErrors.length) {
            arrayOfFloat = this.sFErrors;
            m = i + 4;
            arrayOfFloat[j] = ByteBuffer.wrap(Arrays.copyOfRange(paramArrayOfByte, i, m)).order(ByteOrder.LITTLE_ENDIAN).getFloat();
            j++;
            i = m;
        }

        for (int l = 0; l < arrayOfFloat.length; l++) {
            LogUtils.d("packet_57", "sFErrors" + arrayOfFloat[l] + "");
        }

        this.sDErrors = new float[3];
        j = 0;
        while (j < this.sDErrors.length) {
            arrayOfFloat = this.sDErrors;
            m = i + 4;
            arrayOfFloat[j] = ByteBuffer.wrap(Arrays.copyOfRange(paramArrayOfByte, i, m)).order(ByteOrder.LITTLE_ENDIAN).getFloat();
            j++;
            i = m;
        }

        for (int ll = 0; ll < arrayOfFloat.length; ll++) {
            LogUtils.d("packet_57", "sDErrors" + arrayOfFloat[ll] + "");
        }


        this.sDErrors = new float[3];
        j = 0;
        while (j < this.sDErrors.length) {
            arrayOfFloat = this.sDErrors;
            m = i + 4;
            arrayOfFloat[j] = ByteBuffer.wrap(Arrays.copyOfRange(paramArrayOfByte, i, m)).order(ByteOrder.LITTLE_ENDIAN).getFloat();
            j++;
            i = m;
        }

        for (int ll = 0; ll < arrayOfFloat.length; ll++) {
            LogUtils.d("packet_57", "sDErrors" + arrayOfFloat[ll] + "");
        }
        this.sDErrors = new float[3];
        j = 0;
        while (j < this.sDErrors.length) {
            arrayOfFloat = this.sDErrors;
            m = i + 4;
            arrayOfFloat[j] = ByteBuffer.wrap(Arrays.copyOfRange(paramArrayOfByte, i, m)).order(ByteOrder.LITTLE_ENDIAN).getFloat();
            j++;
            i = m;
        }

        for (int ll = 0; ll < arrayOfFloat.length; ll++) {
            LogUtils.d("packet_57", "sDErrors" + arrayOfFloat[ll] + "");
        }







        this.sUErrors = new float[5];
        j = 0;
        while (j < this.sUErrors.length) {
            arrayOfFloat = this.sUErrors;
            m = i + 4;
            arrayOfFloat[j] = ByteBuffer.wrap(Arrays.copyOfRange(paramArrayOfByte, i, m)).order(ByteOrder.LITTLE_ENDIAN).getFloat();
            j++;
            i = m;
        }
        this.sURoundErrors = new float[5];
        j = 0;
        while (j < this.sURoundErrors.length) {
            arrayOfFloat = this.sURoundErrors;
            m = i + 4;
            arrayOfFloat[j] = ByteBuffer.wrap(Arrays.copyOfRange(paramArrayOfByte, i, m)).order(ByteOrder.LITTLE_ENDIAN).getFloat();
            j++;
            i = m;
        }
        this.sPhaseDisps = new float[5];
        j = 0;
        while (j < this.sPhaseDisps.length) {
            arrayOfFloat = this.sPhaseDisps;
            m = i + 4;
            arrayOfFloat[j] = ByteBuffer.wrap(Arrays.copyOfRange(paramArrayOfByte, i, m)).order(ByteOrder.LITTLE_ENDIAN).getFloat();
            j++;
            i = m;
        }
        this.sPhaseRoundDisps = new float[5];
        for (j = k; j < this.sPhaseRoundDisps.length; j++) {
            arrayOfFloat = this.sPhaseRoundDisps;
            k = i + 4;
            arrayOfFloat[j] = ByteBuffer.wrap(Arrays.copyOfRange(paramArrayOfByte, i, k)).order(ByteOrder.LITTLE_ENDIAN).getFloat();
            i = k;
        }








        this.sUErrors2 = new float[5];
        j = 0;
        while (j < this.sUErrors2.length) {
            arrayOfFloat = this.sUErrors2;
            m = i + 4;
            arrayOfFloat[j] = ByteBuffer.wrap(Arrays.copyOfRange(paramArrayOfByte, i, m)).order(ByteOrder.LITTLE_ENDIAN).getFloat();
            j++;
            i = m;
        }
        this.sURoundErrors2 = new float[5];
        j = 0;
        while (j < this.sURoundErrors2.length) {
            arrayOfFloat = this.sURoundErrors2;
            m = i + 4;
            arrayOfFloat[j] = ByteBuffer.wrap(Arrays.copyOfRange(paramArrayOfByte, i, m)).order(ByteOrder.LITTLE_ENDIAN).getFloat();
            j++;
            i = m;
        }
        this.sPhaseDisps2 = new float[5];
        j = 0;
        while (j < this.sPhaseDisps2.length) {
            arrayOfFloat = this.sPhaseDisps2;
            m = i + 4;
            arrayOfFloat[j] = ByteBuffer.wrap(Arrays.copyOfRange(paramArrayOfByte, i, m)).order(ByteOrder.LITTLE_ENDIAN).getFloat();
            j++;
            i = m;
        }
        this.sPhaseRoundDisps2 = new float[5];
        for (j = k; j < this.sPhaseRoundDisps2.length; j++) {
            arrayOfFloat = this.sPhaseRoundDisps2;
            k = i + 4;
            arrayOfFloat[j] = ByteBuffer.wrap(Arrays.copyOfRange(paramArrayOfByte, i, k)).order(ByteOrder.LITTLE_ENDIAN).getFloat();
            i = k;
        }

        this.sUErrors3 = new float[5];
        j = 0;
        while (j < this.sUErrors3.length) {
            arrayOfFloat = this.sUErrors3;
            m = i + 4;
            arrayOfFloat[j] = ByteBuffer.wrap(Arrays.copyOfRange(paramArrayOfByte, i, m)).order(ByteOrder.LITTLE_ENDIAN).getFloat();
            j++;
            i = m;
        }
        this.sURoundErrors3 = new float[5];
        j = 0;
        while (j < this.sURoundErrors3.length) {
            arrayOfFloat = this.sURoundErrors3;
            m = i + 4;
            arrayOfFloat[j] = ByteBuffer.wrap(Arrays.copyOfRange(paramArrayOfByte, i, m)).order(ByteOrder.LITTLE_ENDIAN).getFloat();
            j++;
            i = m;
        }
        this.sPhaseDisps3 = new float[5];
        j = 0;
        while (j < this.sPhaseDisps3.length) {
            arrayOfFloat = this.sPhaseDisps3;
            m = i + 4;
            arrayOfFloat[j] = ByteBuffer.wrap(Arrays.copyOfRange(paramArrayOfByte, i, m)).order(ByteOrder.LITTLE_ENDIAN).getFloat();
            j++;
            i = m;
        }
        this.sPhaseRoundDisps3 = new float[5];
        for (j = k; j < this.sPhaseRoundDisps3.length; j++) {
            arrayOfFloat = this.sPhaseRoundDisps3;
            k = i + 4;
            arrayOfFloat[j] = ByteBuffer.wrap(Arrays.copyOfRange(paramArrayOfByte, i, k)).order(ByteOrder.LITTLE_ENDIAN).getFloat();
            i = k;
        }
    }
}
